package com.spring.aop.declareparents;

import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.DeclareParents;
import org.springframework.stereotype.Component;

/**
 * @ClassName MyAspect
 * @Description
 * @Author suncx
 * @Date 2020/6/27 15:02
 * @Version 1.0
 */
@Aspect
@Component
public class MyAspect {

    /**
     * com.spring.aop.declareparents.Animal+ 表示增强Animal的所有子类
     *defaultImpl=DuckFood.class 表示默认需要添加的新类
     */
    @DeclareParents(value="com.spring.aop.declareparents.Animal+", defaultImpl=DuckFood.class)
    public Food food;
}